package com.yuyu.commons.redis;

import org.redisson.Redisson;
import org.redisson.config.Config;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author redission client
 * @version 1.0
 * @description: TODO
 * @date 2022/8/2 10:49
 */
@Configuration
public class RedissonClient {

    @Value("${spring.redis.host}")
    private String host;

    @Bean
    public Redisson redisson(){
        //此为单机版
        Config config=new Config();
        config.useSingleServer().setAddress("redis://"+host+":"+6379);
        return (Redisson) Redisson.create(config);
    }
}
